package com.qf.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.dao.UserDao;
import com.qf.pojo.User;
import com.qf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @version v1.0.0
 * @Description:
 * @author: 赵英杰
 * @date: 2022.02.15
 * @since 1.0
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserDao userDao;

    @Override
    public List<User> queryAll() {
        return userDao.queryAll();
    }

    @Override
    public Object queryPage(Integer pageNum, Integer pageSize) {
        //开始分页
        PageHelper.startPage(pageNum,pageSize);

        //查询所有
        Page<User> page = userDao.queryAll();

        PageInfo<User> pageInfo = new PageInfo<>(page);

        return pageInfo;

    }
}
